import type { UploadUserFile } from "element-plus";
import { request } from "./utils";
// import axios from "axios";

// 查询所有房型
export function listAllRoomTypes() {
  return request({
    url: "/hotel/roomTypes/listAll",
    method: "get"
  });
}

// 根据id查询产品
export function getRoomTypeById(id: number) {
  return request({
    url: "/hotel/roomTypes/" + id,
    method: "get"
  });
}
// 查询房型等级
export function getRoomTypeslevels() {
  return request({
    url: "/hotel/levels/listAll",
    method: "get"
  });
}

// 分页查询房型
export function listRoomTypesByPage(query: RoomtypesParams) {
  return request({
    url: "/hotel/roomTypes/page",
    method: "get",
    params: query
  });
}

// 新增房型
export function addRoomTypes(data: RoomtypesForm) {
  return request({
    url: "/hotel/roomTypes/add",
    method: "post",
    data: data
  });
}

// 修改房型
export function updateRoomTypes(data: RoomtypesForm) {
  return request({
    url: "/hotel/roomTypes/update",
    method: "put",
    data: data
  });
}

// 删除类别
export function deleteCategory(categoryId: number) {
  return request({
    url: "/category/" + categoryId,
    method: "delete"
  });
}
// 批量删除房型
export function deleteRoomTypesBatch(roomtypesIds: number[]) {
  return request({
    url: "/hotel/roomTypes/delBatch/" + roomtypesIds,
    method: "delete"
  });
}

export function imgadd(file: FormData) {
  return request({
    url: "/hotel/common/upload",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data"
    },
    data: file
  });
}

//查询参数数据
interface RoomtypesParams {
  pageNum: number;
  pageSize: number;
  level: string;
  beds: number;
  name: string;
  type: string;
}
//新增表单数据
interface RoomtypesForm {
  // image: UploadUserFile[];
  type?: string;
  beds: number;
  name?: string;
  basicPrice?: number;
  level?: string;
  id?: number;
  deposit?: number;
}
//列表数据
interface RoomtypesDTO {
  id?: number;
  name?: string;
  image?: UploadUserFile[];
  type?: number;
  beds?: number;
  basicPrice?: string;
  level?: string;
}

export interface FormAPI {
  getList: () => void;
  dialogOpen: boolean;
  ruleform: RoomtypesForm; // 根据实际情况替换为具体的类型
}
export type { RoomtypesParams, RoomtypesForm, RoomtypesDTO };

/** 
 * pure-admin风格api

import { http } from "@/utils/http";
import type { AjaxResult } from "./types";
import { baseUrlApi } from "./utils";

export const listAllCategory = () => {
  return http.request<AjaxResult>("get", baseUrlApi("/category/listAll"));
};

export const getCategoryById = (categoryId: number) => {
  return http.request<AjaxResult>("get", baseUrlApi("/category/" + categoryId));
};

export const addCategory = (data: CategoryForm) => {
  return http.request<AjaxResult>("post", baseUrlApi("/category"), { data });
};

export const updateCategory = (data: CategoryForm) => {
  return http.request<AjaxResult>("put", baseUrlApi("/category"), { data });
};

export const deleteCategory = (categoryId: number) => {
  return http.request<AjaxResult>(
    "delete",
    baseUrlApi("/category/" + categoryId)
  );
};

 */
